package cn.zucc.edu.madq.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.zucc.edu.madq.dao.ClubMapper;
import cn.zucc.edu.madq.dao.UserClubMapper;
import cn.zucc.edu.madq.pojo.Club;
import cn.zucc.edu.madq.service.ClubService;

@Service("clubService")
public class ClubServiceImpl implements ClubService {

	@Autowired
	private ClubMapper clubMapper;
	@Autowired
	private UserClubMapper userClubMapper;

	@Override
	public List<Club> getAllClub() {
		return clubMapper.selectAll();
	}

	@Override
	public Club getClubById(int id) {
		return clubMapper.selectByPrimaryKey(id);
	}

	@Override
	public int updateClub(Club club) {
		return clubMapper.updateByPrimaryKeySelective(club);
	}

	@Override
	public List<Map<String, Object>> getUserClub(int userId) {
		return userClubMapper.getUserClub(userId);
	}

	@Override
	public List<Map<String, Object>> getNotUserClub(int userId) {
		return userClubMapper.getNotUserClub(userId);
	}

	@Override
	public int regClub(Club club) {
		return clubMapper.insert(club);
	}

	@Override
	public int delUserClub(int userClubId) {
		return userClubMapper.deleteByPrimaryKey(userClubId);
	}

	@Override
	public int addUserClub(int clubId, Integer userId) {
		return userClubMapper.insert(clubId,userId);
	}

	@Override
	public List<Map<String, Object>> getManagerClub(Integer userId) {
		return userClubMapper.getManagerClub(userId);
	}

	@Override
	public List<Map<String, Object>> getBossClub(Integer userId) {
		return userClubMapper.getBossClub(userId);
	}

	@Override
	public int delBossClub(int clubId) {
		return clubMapper.deleteByPrimaryKey(clubId);
	}
	
}
